package vo;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
public class LoginPage {
    public String url = "http://www.oschina.net/";

    public static final String  passwordLoginTab1="/html/body/div[1]/div[1]/div[2]/div/div[1]/div[2]/div[1]/div/div[2]";

    public  String savebox="/html/body/div[1]/div[1]/div[2]/div/div[1]/div[2]/div[2]/div[2]/div[4]/div/div[1]/label";
    /*定义各种情况进行登录操作的页面提示*/
    /*密码为空*/
    public String NoPasswd="/html/body/div[1]/div[1]/div[2]/div/div[1]/div[2]/div[2]/div[2]/div[2]/div";
    /*用户名为空*/
    public String NoUsername="/html/body/div[1]/div[1]/div[2]/div/div[1]/div[2]/div[2]/div[2]/div[1]/div";
    /*用户名和密码均为空*/
    public String NoUsername_Passwd="/html/body/div[1]/div[1]/div[2]/div/div[1]/div[2]/div[2]/div[2]/div[1]/div";
    /*用户名或密码错误*/
    public String Wrong_Username_Password="/html/body/div[1]/div[1]/div[2]/div/div[1]/div[2]/div[2]/div[2]/div[5]";
    /*用户名和密码正确。
    *
    * 判定标记：页面出现“我的空间”链接
    * */
    public String Rigit_Username_Password="/html/body/div[3]/div[1]/div/div/div[3]/ul/a[2]/div/img";
    /*
    public String login_link = "登录";
    public String username = "userMail";
    public String password = "userPassword";
    public String login_button = ".//*[@id='account_login']/form/div/div[5]/button";*/
    //对login页面的元素进行定义
    @FindBy(linkText = "登录")
    private WebElement loginlink;

    @FindBy(xpath =passwordLoginTab1 )
    private WebElement passwordLoginTab;


    @FindBy(xpath = "/html/body/div[1]/div[1]/div[2]/div/div[1]/div[2]/div[2]/div[2]/div[1]/input")
    private WebElement username;
//    @FindBy(xpath = "/html/body/div[1]/div[1]/div[2]/div/div[1]/div[2]/div[2]/div[2]/div[2]/input")
//    private WebElement password;

    @FindBy(name = "password")
    private WebElement password;
    @FindBy(xpath = "/html/body/div[1]/div[1]/div[2]/div/div[1]/div[2]/div[2]/div[2]/div[4]/div/div[1]/label")
    private WebElement save;
    @FindBy(xpath = "/html/body/div[1]/div[1]/div[2]/div/div[1]/div[2]/div[2]/div[2]/div[6]/button")
    private WebElement loginbutton;
    //对各元素设定指定的操作
    public void click_loginlink() {
        loginlink.click();
    }

    public void click_passwordLoginTab() {
        passwordLoginTab.click();
    }
    public void input_username(String Username) {
        username.clear();
        username.sendKeys(Username);
    }
    public void input_password(String Password) {
        password.clear();
        password.sendKeys(Password);
    }
    public void click_savebox() {
        save.click();
    }
    public void click_loginbutton() {
        loginbutton.click();
    }
    public void input_login_data(String Username,String Password){
        input_username(Username);
        input_password(Password);
    }
}